Skip to content

Atc and ux#164

Merged
jfilak merged 4 commits into
jfilak:masterfrom
filak-sap:atc_and_ux
May 15, 2026
Merged

Atc and ux#164
jfilak merged 4 commits into
jfilak:masterfrom
filak-sap:atc_and_ux

Conversation

@filak-sap

Copy link
Copy Markdown
Contributor

No description provided.

filak-sap added 4 commits May 15, 2026 11:51
The ADT backend returns the priority the same way as SAPGUI now.
This commit reverts 07cae87
I used a user without S_DEVELOP and that user cannot create new class.
ADT backend sends the discovery collection for classes with the element
accept holding an empty string. The empty string was added as the
accepted mime-type for oo/classes and the error output was highly
confusing:

  Not supported mimes:  not in application/vnd.sap.super.cool.txt+xml;application/vnd.sap.super.cool.txt.v2+xml

The new message will be:

  Not supported mimes for awesome/success: "application/something.else+xml" not in "application/vnd.sap.super.cool.txt+xml;application/vnd.sap.super.cool.txt.v2+xml"
For some reason, in the case your use does not have S_DEVELOP
the ADT backend sends collections XML in the discovery response
with empty an <accept> tag instead of leaving it out completely.

Without this patch, sapcli believes that ADT expects empty string in
the HTTP header Content-Type for data of the corresponding object.

This patch adds ignoring of empty accepts which leads into no mime type
registration. That leads into use of the default mime type assigned to
an ADT object mapper. And that should lead into ADT backend error if
sapcli sends a request for modification/creation of such an object type.

I do not want to add a permissions evaluation engine into sapcli - the
ABAP side must handle it correctly because otherwise we would have a
security hole in the backend.
In the case the class.create() fails, we go to finally and call
class.delete() which will probably fail on its own exception because the
object most probably does not exist.
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR removes ATC result post-processing, filters empty MIME types during ADT discovery parsing, improves MIME type error messages with object context, and prevents ABAP class deletion failures from overriding primary execution results via warning emission instead of exception propagation.

Changes

Bug fixes and error handling improvements

Layer / File(s) Summary
ATC finding priority adjustment removal
sap/adt/atc.py, test/unit/test_sap_adt_atc.py
The post-processing loop that incremented ATC finding priority values by 1 is removed. Test assertion updated to expect unadjusted priority values.
Discovery MIME type filtering and validation
sap/adt/core.py, test/unit/fixtures_adt.py, test/unit/test_sap_adt_connection.py
_DiscoveryHandler.endElement skips empty app:accept content when building MIME type lists. Fixture extended with stub workspace entries for empty and concrete MIME types. Test validates complete collection-types mappings including cases with no MIME types and cases with specific MIME types.
MIME type error messaging with object context
sap/adt/objects.py, test/unit/test_sap_adt_object.py
find_mime_version() error now includes object basepath prefix in the exception message. Test assertion updated to match the new error message format.
ABAP class deletion error handling with warnings
sap/platform/abap/run.py, test/unit/test_sap_platform_abap_run.py
execute_abap now catches SAPCliError during temporary class deletion and emits a warning instead of raising, preventing deletion failures from overriding execution results. Tests verify warning emission in success and failure paths.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Atc and ux' is vague and does not convey meaningful information about the changeset. Use a more descriptive title that summarizes the main change, such as 'Remove ATC priority adjustment and improve error handling' or 'Fix ATC priority handling and MIME type validation'.
Description check ❓ Inconclusive No pull request description was provided by the author. Add a description explaining the purpose and scope of changes across the modified files.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
test/unit/test_sap_adt_object.py (1)

242-243: ⚡ Quick win

Fix continuation line indentation.

The string continuation at line 243 is under-indented according to PEP 8 style guidelines and should align with the opening quote.

♻️ Proposed fix
         self.assertEqual(str(caught.exception),
-            'Not supported mimes for awesome/success: "application/something.else+xml" not in "application/vnd.sap.super.cool.txt+xml;application/vnd.sap.super.cool.txt.v2+xml"')
+                         'Not supported mimes for awesome/success: "application/something.else+xml" not in "application/vnd.sap.super.cool.txt+xml;application/vnd.sap.super.cool.txt.v2+xml"')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_adt_object.py` around lines 242 - 243, Adjust the
continuation indentation of the long expected string in the assertion so it
aligns with the opening quote of the first line of the self.assertEqual call;
locate the self.assertEqual(str(caught.exception), ...) in
test_sap_adt_object.py and re-indent the continued line containing 'Not
supported mimes for awesome/success: "application/something.else+xml" ...' to
match the opening quote position to satisfy PEP 8 string continuation alignment.
test/unit/test_sap_adt_connection.py (1)

315-326: ⚡ Quick win

Fix continuation line indentation.

The list continuation starting at line 316 is over-indented according to PEP 8 style guidelines.

♻️ Proposed fix
-        self.assertEqual(list(self.connection.collection_types.keys()), [
-              '/sap/bc/adt/bopf/businessobjects',
-              '/sap/bc/adt/packages',
-              '/sap/bc/adt/functions/groups/{groupname}/fmodules',
-              '/sap/bc/adt/functions/groups/{groupname}/includes',
-              '/sap/bc/adt/functions/groups',
-              '/sap/bc/adt/ddic/ddl/formatter/identifiers',
-              '/sap/bc/adt/sadl/gw/mde',
-              '/sap/bc/adt/quickfixes/evaluation',
-              '/sap/bc/adt/wdy/views',
-              '/sap/bc/adt/stub/test_accept',
-        ])
+        self.assertEqual(list(self.connection.collection_types.keys()), [
+            '/sap/bc/adt/bopf/businessobjects',
+            '/sap/bc/adt/packages',
+            '/sap/bc/adt/functions/groups/{groupname}/fmodules',
+            '/sap/bc/adt/functions/groups/{groupname}/includes',
+            '/sap/bc/adt/functions/groups',
+            '/sap/bc/adt/ddic/ddl/formatter/identifiers',
+            '/sap/bc/adt/sadl/gw/mde',
+            '/sap/bc/adt/quickfixes/evaluation',
+            '/sap/bc/adt/wdy/views',
+            '/sap/bc/adt/stub/test_accept',
+        ])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/test_sap_adt_connection.py` around lines 315 - 326, The list
literal passed to self.assertEqual comparing
list(self.connection.collection_types.keys()) is over-indented; fix by adjusting
the continuation indentation so the items either align under the opening bracket
or use a 4-space hanging indent per PEP 8. Update the list starting at the call
to self.assertEqual (the bracketed list of paths) so each string element lines
up consistently with the chosen style and remove the extra indent before
'/sap/bc/adt/stub/test_accept'.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/unit/test_sap_adt_connection.py`:
- Around line 315-326: The list literal passed to self.assertEqual comparing
list(self.connection.collection_types.keys()) is over-indented; fix by adjusting
the continuation indentation so the items either align under the opening bracket
or use a 4-space hanging indent per PEP 8. Update the list starting at the call
to self.assertEqual (the bracketed list of paths) so each string element lines
up consistently with the chosen style and remove the extra indent before
'/sap/bc/adt/stub/test_accept'.

In `@test/unit/test_sap_adt_object.py`:
- Around line 242-243: Adjust the continuation indentation of the long expected
string in the assertion so it aligns with the opening quote of the first line of
the self.assertEqual call; locate the self.assertEqual(str(caught.exception),
...) in test_sap_adt_object.py and re-indent the continued line containing 'Not
supported mimes for awesome/success: "application/something.else+xml" ...' to
match the opening quote position to satisfy PEP 8 string continuation alignment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e57a3ee9-88db-4a2a-9025-b9173a180661

📥 Commits

Reviewing files that changed from the base of the PR and between 9e91606 and d53c549.

📒 Files selected for processing (9)
  • sap/adt/atc.py
  • sap/adt/core.py
  • sap/adt/objects.py
  • sap/platform/abap/run.py
  • test/unit/fixtures_adt.py
  • test/unit/test_sap_adt_atc.py
  • test/unit/test_sap_adt_connection.py
  • test/unit/test_sap_adt_object.py
  • test/unit/test_sap_platform_abap_run.py
💤 Files with no reviewable changes (1)
  • sap/adt/atc.py

@jfilak jfilak merged commit 3397ca4 into jfilak:master May 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants